package com.iflytek.day28._01_serialize;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class _02_ObjectInputStreamDemo {
  public static void main(String[] args) throws IOException, ClassNotFoundException {
    // ObjectInputStream(InputStream in)：创建从指定的InputStream读取的ObjectInputStream
    ObjectInputStream ois = new ObjectInputStream(new FileInputStream("src\\com\\iflytek\\day28\\_01_serialize\\oos.txt"));
    // Object readObject()：从ObjectInputStream读取一个对象
    Object obj = ois.readObject();
    Student s = (Student) obj;
    System.out.println(s.getName() + "," + s.getAge());

    ois.close();
  }
}
